package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.Transfer;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.query.TransferQueryObject;
import cn.wolfcode.crm.service.ITransferService;
import cn.wolfcode.crm.util.JsonResult;
import cn.wolfcode.crm.util.PageResult;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("transfer")
public class TransferController {

    @Autowired
    private ITransferService transferService;

    @RequestMapping("view")
    @RequiresPermissions(value = {"transfer:view","转移记录页面"},logical = Logical.OR)
    public String view() throws Exception{

        return "transfer/transfer";
    }

    @RequestMapping("selectAll")
    @ResponseBody
    public List<Transfer> selectAll() throws Exception{
        return transferService.selectAll();
    }


    @RequestMapping("list")
    @ResponseBody
    public PageResult list(TransferQueryObject qo) throws Exception{
        return transferService.query(qo);
    }

}
